package com.qing.administer.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qing.administer.entity.SysConfig;
import com.qing.administer.entity.SysMenu;
import com.qing.administer.mapper.SysConfigMapper;
import com.qing.administer.service.SysConfigService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * <p>
 * 系统配置信息表 服务实现类
 * </p>
 *
 * @author qing
 * @since 2021-09-17
 */
@Service
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements SysConfigService {


	@Autowired
	private SysConfigMapper sysConfigMapper;

	@Override
	public Page<SysConfig> findPage(Long current, Long size, Integer status, String keyword) {
		Page<SysConfig> page=new Page<>(current,size);
		QueryWrapper<SysConfig> queryWrapper=new QueryWrapper<>();
		if(StringUtils.hasLength(keyword)){
			queryWrapper.likeRight("param_key",keyword).or().likeRight("param_value",keyword);
		}
		if(status!=null&&status!=-1){
			queryWrapper.eq("status",status);
		}
		return sysConfigMapper.selectPage(page,queryWrapper);
	}
}
